package cn.itsource.org.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.org.pojo.dto.LoginDto;
import cn.itsource.org.service.IEmployeeService;
import cn.itsource.org.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private IEmployeeService employeeService;

    @Autowired
    private IUserService userService;

    /**
     * 后台的登录接口
     * 1.post  2./login/system 3.接受参数
     */
    @PostMapping("/system")
    public AjaxResult loginSystem(@RequestBody LoginDto loginDto){

        //调用登录方法
        return employeeService.loginSystem(loginDto);
    }
    /**
     * user后台的登录接口
     * 1.post  2./login/system 3.接受参数
     */
    @PostMapping("/account")
    public AjaxResult loginUser(@RequestBody LoginDto loginDto){

        //调用登录方法
        return userService.loginUser(loginDto);
    }

}
